package com._bytecode.__asm._ClassWriter;

import org.objectweb.asm.ClassWriter;

/**
 * @Author: huangya
 * @Date: 2020/09/16
 * @Description:
 */
public class StubClassLoader extends ClassLoader {

    @Override
    protected Class findClass(String name)
            throws ClassNotFoundException {
        if (name.endsWith("_Stub")) {
            ClassWriter cw = new ClassWriter(0);
            byte[] b = cw.toByteArray();
            return defineClass(name, b, 0, b.length);
        }
        return super.findClass(name);
    }

}
